package com.platform.controller;

import com.platform.entity.ReturnEntity;
import com.platform.entity.WithdrawEntity;
import com.platform.service.WithdrawService;
import com.platform.utils.PageUtils;
import com.platform.utils.Query;
import com.platform.utils.R;
import com.platform.utils.excel.ExcelExport;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * Controller
 *
 * @author lipengjun
 * @email 939961241@qq.com
 * @date 2017-08-16 15:02:28
 */
@RestController
@RequestMapping("withdraw")
public class WithdrawController {
    @Autowired
    private WithdrawService withdrawService;
    /**
     * 查看列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("withdraw:list")
    public R list(@RequestParam Map<String, Object> params) {
        //查询列表数据
        Query query = new Query(params);

        List<WithdrawEntity> withdrawList = withdrawService.queryList(query);
        int total = withdrawService.queryTotal(query);

        PageUtils pageUtil = new PageUtils(withdrawList, total, query.getLimit(), query.getPage());

        return R.ok().put("page", pageUtil);
    }


    /**
     * 查看信息
     */
    @RequestMapping("/deal")
    @RequiresPermissions("withdraw:deal")
    public R deal(@RequestBody WithdrawEntity withdrawEntity) {
       return  withdrawService.deal(withdrawEntity.getId());
    }



}
